{include file="public/header"/}
{include file="public/add_header"/}
<form method="post" class="form-horizontal" action="save" id="layer-form">
    {if condition="$data['id']!=''"}<input type="hidden" value="{$data['id']}" name="id">{/if}
    <!--表单项-->
        
                <div class="form-group">
                    <label class="col-sm-2 control-label">类型名称</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="name" value="{$data['name']}" >
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">编码</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="code" value="{$data['code']}" >
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">描述</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="about" value="{$data['about']}" >
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
    <!--/表单项-->
    {$html->submit_btn()}
</form>
<input type="hidden" value="{$data['id']}" id="type_id">
{include file="public/add_footer"/}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <!--列表部分-->
            <div id="dict" class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="row common-search" style="margin-top: 10px;margin-bottom: 20px" hidden>
                        <div class="col-sm-12">
                            <form class="form-inline table-form">
                                <!--搜索项-->
                                <div class="form-group">
                                    <input type="text" name="name" placeholder="请输入名称" class="form-control">
                                </div>
                                <!--此处可自定义查询条件-->
                                <!--搜索项-->
                                {$html->search_btn()}
                            </form>
                        </div>
                    </div>
                    <div  class="toolbar">
                        {$html->toolbar()}
                        <!--此处可自定义工具栏-->
                        <!--<button class="btn btn-primary btn-sm" type="button"><i class="fa fa-plus"></i> 自定义</button>&nbsp;-->
                    </div>
                    <table class="table table-striped table-hover table-bordered"></table>
                    <input id="tableName" value="" type="hidden">
                </div>
            </div>
        </div>
        <!--/列表部分-->
    </div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
    $(function(){
        //初始化表格
        var tableName="dict";
        initTable({
            name:tableName,
            config:{
                index_url: '/admin/sys.dict/loadData?type_id={$data["id"]}',
                add_url: '/admin/sys.dict/add',
                del_url: '/admin/sys.dict/del',
                table: tableName
            },
            columns:[
                {checkbox: true},
                {title: 'ID',field:'id'},
                {title: '字典名称', field: 'name'},
                {title: '编码', field: 'code'},
                {title: '字典值', field: 'val'},
                {title: '描述', field: 'about'},
                {title: '操作', field: 'operate',formatter: function (value, row){
                    var str="";
                    var editUrl="/admin/sys.dict/add?id=" +row.id ;
                    var e = ' <button class="btn btn-primary btn-xs" type="button" onclick="layer_open(\''+editUrl+'\',\'编辑\')"><i class="fa fa-edit"></i> 编辑</button> ';
                    str+=e;
                    var delUrl="/admin/sys.dict/del?id="+row.id;
                    var d = '<button class="btn btn-danger btn-xs" type="button" onclick="table_del(\''+delUrl+'\',\''+tableName+'\');"><i class="fa fa-trash"></i> 删除</button>';
                    str+=d;
                    return str;}}
            ]
        });
    });
</script>